<!DOCTYPE html>
<html>
  <head>
     
    <meta charset="UTF-8">
    <title>Apex安装及配置 - 我的元宇宙</title>
    <link rel="shortcut icon" href="/static/img/icon.png">
    <link rel="icon" href="/static/img/icon.png" sizes="192x192"/>
    
<link rel="stylesheet" href="/static/kico.css">
<link rel="stylesheet" href="/static/hingle.css">

    
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/FortAwesome/Font-Awesome/css/font-awesome.min.css">

    <meta name="viewport" content="width=device-width, maximum-scale=1, initial-scale=1"/>
    <meta property="og:site_name" content="我的元宇宙">
    <meta property="og:title" content="Apex安装及配置"/>
    
 
<meta name="generator" content="Hexo 5.4.0"></head>

  <body>
    <header>
    <div class="head-title">
        <h4>我的元宇宙</h4>
    </div>
    <div class="head-action">
        <div class="toggle-btn"></div>
        <div class="light-btn"></div>
        <div class="search-btn"></div>
    </div>
    <form class="head-search" method="post">
        <input type="text" name="s" placeholder="搜索什么？">
    </form>
    <nav class="head-menu">
        <a href="/">首页</a>
        <div class="has-child">
            <a>分类</a>
            <div class="sub-menu">
                <a class="category-link" href="/categories/%E5%AD%A6%E4%B9%A0/">学习</a><a class="category-link" href="/categories/%E6%9D%82%E9%A1%B9/">杂项</a><a class="category-link" href="/categories/%E7%AC%94%E8%AE%B0/">笔记</a><a class="category-link" href="/categories/%E8%BD%AC%E8%BD%BD/">转载</a>
            </div>
        </div>
        
            <a href="/about">关于我</a>
        
    </nav>
</header>

    <main>
    <div class="wrap min">
        <section class="post-title">
            <h2>Apex安装及配置</h2>
            <div class="post-meta">
                <time class="date">2021.11.03</time>
            
                <span class="category"><a class="category-link" href="/categories/%E7%AC%94%E8%AE%B0/">笔记</a>，<a class="category-link" href="/categories/%E7%AC%94%E8%AE%B0/Oracle/">Oracle</a>，<a class="category-link" href="/categories/%E7%AC%94%E8%AE%B0/Oracle/Apex/">Apex</a></span>
            
            </div>
        </section>
        <article class="post-content">
        
            <h2 id="0-前提"><a href="#0-前提" class="headerlink" title="0.前提"></a>0.前提</h2><ol>
<li>ssh免密,改端口,禁用root登录</li>
<li>防火墙配置</li>
<li>添加用户,赋权</li>
<li>Oracle 数据库本次是四个对应不同连接<ol>
<li>Oracle 19c数据库 test162 (非CDB/PDB模式)</li>
<li>Oracle 19c数据库 testdb  (CDB/PDB模式 165)</li>
<li>Oracle 19c数据库 test163 (CDB/PDB模式)</li>
<li>Oracle 19c数据库 test164 (CDB/PDB模式)</li>
</ol>
</li>
<li>Oracle 驱动环境<a target="_blank" rel="noopener" href="https://www.oracle.com/database/technologies/instant-client.html">Oracle Client 下载</a> - <a target="_blank" rel="noopener" href="https://docs.oracle.com/en/database/oracle/oracle-database/21/lacli/install-instant-client-using-zip.html">官方安装参考</a></li>
<li>SQLcl (<strong>可选</strong>) <a target="_blank" rel="noopener" href="https://docs.oracle.com/en/database/oracle/sql-developer-command-line/20.4/sqcug/working-sqlcl.html#">官方文档</a></li>
<li>jdk-16 <a target="_blank" rel="noopener" href="https://www.oracle.com/java/technologies/javase-downloads.html">Oracle JDK 下载</a></li>
<li>tomcat-9.0.45 <a target="_blank" rel="noopener" href="https://tomcat.apache.org/download-90.cgi">Tomcat 9 下载</a></li>
<li>nginx-1.19.9 <a target="_blank" rel="noopener" href="http://nginx.org/download/nginx-1.19.10.tar.gz">下载 wget http://nginx.org/download/nginx-1.19.10.tar.gz</a></li>
<li>ords <a target="_blank" rel="noopener" href="https://www.oracle.com/database/technologies/appdev/rest-data-services-downloads.html">下载地址</a> - <a target="_blank" rel="noopener" href="https://docs.oracle.com/en/database/oracle/oracle-rest-data-services/20.4/aelig/using-multitenant-architecture-oracle-rest-data-services.html">官方文档</a></li>
<li>APEX <a target="_blank" rel="noopener" href="https://www.oracle.com/tools/downloads/apex-downloads.html">下载地址</a> - <a target="_blank" rel="noopener" href="https://docs.oracle.com/en/database/oracle/application-express/21.1/installandupgrade.html">官方文档</a></li>
<li>检查 <strong>Oracle字符集</strong> NLS_CHARACTERSET AL32UTF8 后面会涉及到中文乱码</li>
</ol>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> nls_database_parameters <span class="keyword">where</span> <span class="keyword">parameter</span> <span class="keyword">like</span> <span class="string">&#x27;%CHARACTERSET%&#x27;</span>;</span><br></pre></td></tr></table></figure>

<ol start="13">
<li><p>配置多个数据库</p>
<ol>
<li>test162  对应url <a target="_blank" rel="noopener" href="http://xxxx.com/edex/test162/f?p=4000">http://xxxx.com/edex/test162/f?p=4000</a></li>
<li>testdb 对应url <a target="_blank" rel="noopener" href="http://xxxx.com/edex/testdb/f?p=4000">http://xxxx.com/edex/testdb/f?p=4000</a></li>
<li>test163 对应url <a target="_blank" rel="noopener" href="http://xxxx.com/edex/test163/f?p=4000">http://xxxx.com/edex/test163/f?p=4000</a></li>
<li>test164 对应url <a target="_blank" rel="noopener" href="http://xxxx.com/edex/test164/f?p=4000">http://xxxx.com/edex/test164/f?p=4000</a></li>
</ol>
</li>
<li><p>Oracle</p>
<ol>
<li>命名长度128 <a target="_blank" rel="noopener" href="https://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/COMPATIBLE.html">文档</a></li>
<li>支持varchar2 超过4000 <a target="_blank" rel="noopener" href="https://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/MAX_STRING_SIZE.html">文档</a></li>
<li>字符集UTF8</li>
<li>准备 user 不过期的profile <a target="_blank" rel="noopener" href="https://docs.oracle.com/en/database/oracle/application-express/21.1/htmig/downloading-installing-apex.html">文档</a></li>
<li>准备 user 半年或者一年过期的profile <a target="_blank" rel="noopener" href="https://docs.oracle.com/en/database/oracle/application-express/21.1/htmig/downloading-installing-apex.html">文档</a></li>
<li>指定 JOB_QUEUE_PROCESSES = cpu* 20 <a target="_blank" rel="noopener" href="https://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/JOB_QUEUE_PROCESSES.html">文档</a></li>
</ol>
</li>
</ol>
<h2 id="整体架构"><a href="#整体架构" class="headerlink" title="整体架构"></a>整体架构</h2><p><img src="https://nuczmjfhvndrjhrfpqkcyeimmdrcsebw.oss-cn-shanghai.aliyuncs.com/jbfffurvdqmpvhukbzbsea/markdown/asawqwdjcfkwjqknvsoqwdqsaa.jpg/jbfffurvdqmpvhukbzbsea"></p>
<h2 id="1-Tomcat-Java-tomcat"><a href="#1-Tomcat-Java-tomcat" class="headerlink" title="1.Tomcat(Java,tomcat)"></a>1.Tomcat(Java,tomcat)</h2><h3 id="1-1-JAVA"><a href="#1-1-JAVA" class="headerlink" title="1.1.JAVA"></a>1.1.JAVA</h3><p><a target="_blank" rel="noopener" href="https://www.oracle.com/java/technologies/javase-downloads.html">Oracle JDK 下载</a></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">rpm -ivh jdk-16_linux-x64_bin.rpm</span><br><span class="line">find / -name jav*</span><br><span class="line">...</span><br><span class="line">/usr/java/jdk-16/bin/java</span><br><span class="line">...</span><br><span class="line">&lt;!--设置环境变量--&gt;</span><br><span class="line">vim  /etc/profile</span><br><span class="line">...</span><br><span class="line"><span class="built_in">export</span> JAVA_HOME=<span class="string">&quot;/usr/java/jdk-16&quot;</span></span><br><span class="line"><span class="built_in">export</span> JAVA_BIN=<span class="variable">$JAVA_HOME</span>/bin</span><br><span class="line"><span class="built_in">export</span> PATH=<span class="variable">$JAVA_BIN</span>:<span class="variable">$JAVA_HOME</span>:<span class="variable">$PATH</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h3 id="1-2-Tomcat"><a href="#1-2-Tomcat" class="headerlink" title="1.2.Tomcat"></a>1.2.Tomcat</h3><p><a target="_blank" rel="noopener" href="https://tomcat.apache.org/download-90.cgi">Tomcat 9 下载</a></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">unzip  apache-tomcat-9.0.45.zip </span><br><span class="line">&lt;!--创建tomcat运行用户--&gt;</span><br><span class="line">useradd -d /opt/tomcat -s /bin/nologin tomcat</span><br><span class="line">mv ./apache-tomcat-9.0.45 /opt/tomcat</span><br><span class="line">chown -R tomcat:tomcat /opt/tomcat</span><br><span class="line">&lt;!--设置环境变量--&gt;</span><br><span class="line">vim  /etc/profile</span><br><span class="line">...</span><br><span class="line"><span class="built_in">export</span> CATALINA_HOME=/opt/tomcat</span><br><span class="line"><span class="built_in">export</span> CATALINA_BASE=/opt/tomcat</span><br></pre></td></tr></table></figure>

<p>1.设置tomcat后台进程及自启 <a target="_blank" rel="noopener" href="https://www.itzgeek.com/how-tos/linux/centos-how-tos/how-to-install-apache-tomcat-9-on-rhel-8.html">参考</a></p>
<p><code>vim /etc/systemd/system/tomcat.service</code><br><strong>TODO  参数可能要改</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><span class="line">[Unit]</span><br><span class="line">Description=Apache Tomcat 9 Servlet Container</span><br><span class="line">Wants=network.target</span><br><span class="line">After=network.target</span><br><span class="line"></span><br><span class="line">[Service]</span><br><span class="line">User=tomcat</span><br><span class="line">Group=tomcat</span><br><span class="line">Type=forking</span><br><span class="line">UMask=0007</span><br><span class="line">RestartSec=10</span><br><span class="line"></span><br><span class="line">Environment=CATALINA_PID=/opt/tomcat/tomcat.pid</span><br><span class="line">Environment=CATALINA_HOME=/opt/tomcat</span><br><span class="line">Environment=CATALINA_BASE=/opt/tomcat</span><br><span class="line">Environment=JAVA_HOME=/usr/java/jdk-16</span><br><span class="line">Environment=<span class="string">&#x27;CATALINA_OPTS=-Xms512M -Xmx1G -Djava.net.preferIPv4Stack=true&#x27;</span></span><br><span class="line">Environment=<span class="string">&#x27;JAVA_OPTS=-server -Xms4096m -Xmx4096m -XX:PermSize=256M -XX:MaxNewSize=512m -XX:MaxPermSize=512m -Djava.awt.headless=true&#x27;</span></span><br><span class="line"></span><br><span class="line">ExecStart=/u01/tomcat/bin/startup.sh</span><br><span class="line">ExecStart=/opt/tomcat/bin/startup.sh</span><br><span class="line">ExecStop=/opt/tomcat/bin/shutdown.sh</span><br><span class="line">SuccessExitStatus=143</span><br><span class="line">Restart=on-failure</span><br><span class="line"></span><br><span class="line">[Install]</span><br><span class="line">WantedBy=multi-user.target</span><br></pre></td></tr></table></figure>

<ol start="2">
<li><p>优化</p>
 <figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">rm -rf /opt/tomcat/webapps/manager  /opt/tomcat/webapps/host-manager</span><br><span class="line">rm -rf ../webapps/docs  ../webapps/examples</span><br></pre></td></tr></table></figure></li>
<li><p>Server.xml 配置 <code>vim /opt/tomcat/conf/server.xml</code></p>
 <figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line">...</span><br><span class="line">   <span class="tag">&lt;<span class="name">Service</span> <span class="attr">name</span>=<span class="string">&quot;Catalina&quot;</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">Connector</span> <span class="attr">port</span>=<span class="string">&quot;8080&quot;</span> <span class="attr">protocol</span>=<span class="string">&quot;HTTP/1.1&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">connectionTimeout</span>=<span class="string">&quot;20000&quot;</span>  </span></span><br><span class="line"><span class="tag">            <span class="attr">scheme</span>=<span class="string">&quot;https&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">redirectPort</span>=<span class="string">&quot;8443&quot;</span> /&gt;</span> <span class="comment">&lt;!--奇奇怪怪的oauth2回调跳转 --&gt;</span></span><br><span class="line"> ...</span><br><span class="line">  <span class="tag">&lt;<span class="name">Host</span> <span class="attr">name</span>=<span class="string">&quot;localhost&quot;</span>  <span class="attr">appBase</span>=<span class="string">&quot;webapps&quot;</span></span></span><br><span class="line"><span class="tag">         <span class="attr">unpackWARs</span>=<span class="string">&quot;true&quot;</span> <span class="attr">autoDeploy</span>=<span class="string">&quot;true&quot;</span>&gt;</span></span><br><span class="line">     <span class="tag">&lt;<span class="name">Valve</span> <span class="attr">className</span>=<span class="string">&quot;org.apache.catalina.valves.AccessLogValve&quot;</span> <span class="attr">directory</span>=<span class="string">&quot;logs&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">prefix</span>=<span class="string">&quot;localhost_access_log&quot;</span> <span class="attr">suffix</span>=<span class="string">&quot;.txt&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">pattern</span>=<span class="string">&quot;%h %l %u %t <span class="symbol">&amp;quot;</span>%r<span class="symbol">&amp;quot;</span> %s %b&quot;</span> /&gt;</span></span><br><span class="line">    </span><br><span class="line">       <span class="comment">&lt;!-- nginx配置--&gt;</span></span><br><span class="line">      <span class="tag">&lt;<span class="name">Valve</span> <span class="attr">className</span>=<span class="string">&quot;org.apache.catalina.valves.RemoteIpValve&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">remoteIpHeader</span>=<span class="string">&quot;X-Forwarded-For&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">protocolHeader</span>=<span class="string">&quot;X-Forwarded-Proto&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">internalProxies</span>=<span class="string">&quot;127\.0\.0\.1|10\.x\.x\.x&quot;</span>/&gt;</span> <span class="comment">&lt;!--nginx服务器地址 --&gt;</span></span><br><span class="line">   <span class="tag">&lt;/<span class="name">Host</span>&gt;</span></span><br><span class="line">...</span><br></pre></td></tr></table></figure></li>
</ol>
<h2 id="2-Apex"><a href="#2-Apex" class="headerlink" title="2.Apex"></a>2.Apex</h2><h3 id="2-1-Oracle-Client"><a href="#2-1-Oracle-Client" class="headerlink" title="2.1. Oracle Client"></a>2.1. Oracle Client</h3><p><a target="_blank" rel="noopener" href="https://www.oracle.com/database/technologies/instant-client.html">Oracle Client 下载</a> - <a target="_blank" rel="noopener" href="https://docs.oracle.com/en/database/oracle/oracle-database/21/lacli/install-instant-client-using-zip.html">官方安装参考</a> - <a target="_blank" rel="noopener" href="https://www.oracle.com/database/technologies/instant-client.html">Oracle Client Sqlplus 下载</a></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">mkdir  /opt/oracle_client </span><br><span class="line">mv /home/xxxx/instantclient-basic-linux.x64-21.1.0.0.0.zip  /opt/oracle_client</span><br><span class="line">&lt;!-- sqlplus--&gt;</span><br><span class="line">mv /home/xxxx/instantclient-sqlplus-linux.x64-21.1.0.0.0.zip /opt/oracle_client</span><br><span class="line">unzip instantclient-basic-linux.x64-21.1.0.0.0.zip</span><br><span class="line">unzip instantclient-sqlplus-linux.x64-21.1.0.0.0.zip </span><br><span class="line">yum install libaio</span><br><span class="line"></span><br><span class="line">sh -c <span class="string">&quot;echo /opt/oracle_client/instantclient_21_1 &gt;/etc/ld.so.conf.d/oracle-instantclient.conf&quot;</span></span><br><span class="line"></span><br><span class="line">ldconfig</span><br><span class="line"></span><br><span class="line">&lt;!--设置环境变量--&gt;</span><br><span class="line">vim  /etc/profile</span><br><span class="line">...</span><br><span class="line"><span class="built_in">export</span> PATH=<span class="variable">$JAVA_BIN</span>:<span class="variable">$JAVA_HOME</span>:<span class="variable">$PATH</span>:/opt/oracle_client/instantclient_21_1</span><br></pre></td></tr></table></figure>

<h3 id="2-2-SQLcl-可选"><a href="#2-2-SQLcl-可选" class="headerlink" title="2.2. SQLcl(可选)"></a>2.2. SQLcl(可选)</h3><p><a target="_blank" rel="noopener" href="https://docs.oracle.com/en/database/oracle/sql-developer-command-line/20.4/sqcug/working-sqlcl.html#">官方文档</a> - <a target="_blank" rel="noopener" href="https://oracle-base.com/articles/misc/articles-misc#sqlcl">Oracle-base 文档</a> - <a target="_blank" rel="noopener" href="https://mp.weixin.qq.com/s/lzbrXdFNIK5xmeugDrc3IQ">SQLcl这个可爱的小工具，来了解一下呀~  微信</a></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">unzip sqlcl-20.4.2.35.2359.zip</span><br><span class="line">mv sqlcl /opt/sqlcl</span><br><span class="line">&lt;!--设置环境变量--&gt;</span><br><span class="line">vim  /etc/profile</span><br><span class="line">...</span><br><span class="line"><span class="built_in">export</span> PATH=<span class="variable">$JAVA_BIN</span>:<span class="variable">$JAVA_HOME</span>:<span class="variable">$PATH</span>:/opt/oracle_client/instantclient_21_1:/opt/sqlcl/bin</span><br><span class="line"></span><br><span class="line">&lt;!--<span class="built_in">test</span>--&gt;</span><br><span class="line">sql sys/我是密码@x.x.x.x:x/testpdb as SYSDBA</span><br><span class="line">&lt;!--或者--&gt;</span><br><span class="line">sql hr/我是密码@x.x.x.x:x/testpdb</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h3 id="2-3-Apex"><a href="#2-3-Apex" class="headerlink" title="2.3. Apex"></a>2.3. Apex</h3><p><a target="_blank" rel="noopener" href="https://www.oracle.com/tools/downloads/apex-192-downloads.html">官方下载</a> - <a target="_blank" rel="noopener" href="https://docs.oracle.com/en/database/oracle/application-express/19.2/htmig/installing-application-express-into-application-container.html">官方文档</a></p>
<ol>
<li>CDB/PDB模式 PBD 本地安装apex</li>
</ol>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line"><span class="operator">&lt;</span><span class="operator">!</span><span class="comment">--创建pdb--&gt;</span></span><br><span class="line"><span class="keyword">CREATE</span> PLUGGABLE DATABASE testdb ADMIN <span class="keyword">USER</span> admin IDENTIFIED <span class="keyword">BY</span> &quot;w&#125;RZJVCrzd&quot; FILE_NAME_CONVERT<span class="operator">=</span>(<span class="string">&#x27;pdbseed&#x27;</span>,<span class="string">&#x27;testdb&#x27;</span>);</span><br><span class="line"></span><br><span class="line"><span class="operator">&lt;</span><span class="operator">!</span><span class="comment">--打开pdb--&gt;</span></span><br><span class="line"><span class="keyword">ALTER</span> PLUGGABLE DATABASE testdb <span class="keyword">OPEN</span>;</span><br><span class="line"></span><br><span class="line"><span class="operator">&lt;</span><span class="operator">!</span><span class="comment">--删除CDB中的apex--&gt;</span></span><br><span class="line"><span class="variable">@apxremov</span>.<span class="keyword">sql</span></span><br><span class="line"></span><br><span class="line"><span class="operator">&lt;</span><span class="operator">!</span><span class="comment">--激活pdb--&gt;</span></span><br><span class="line"><span class="keyword">ALTER</span> SESSION <span class="keyword">SET</span> CONTAINER <span class="operator">=</span> testdb;</span><br><span class="line"></span><br><span class="line"><span class="operator">&lt;</span><span class="operator">!</span><span class="comment">--PDB安装apex--&gt;</span></span><br><span class="line"><span class="variable">@apexins</span>.<span class="keyword">sql</span> SYSAUX SYSAUX TEMP <span class="operator">/</span>i<span class="operator">/</span></span><br><span class="line"></span><br><span class="line"><span class="operator">&lt;</span><span class="operator">!</span><span class="comment">--验证apex安装结果--&gt;</span></span><br><span class="line"><span class="keyword">begin</span></span><br><span class="line">    sys.dbms_utility.compile_schema( <span class="string">&#x27;APEX_190200&#x27;</span>, <span class="literal">false</span> );</span><br><span class="line">    sys.dbms_utility.compile_schema( <span class="string">&#x27;FLOWS_FILES&#x27;</span>, <span class="literal">false</span> );</span><br><span class="line"><span class="keyword">end</span>;</span><br><span class="line"><span class="keyword">select</span> app_name, app_version, app_status <span class="keyword">from</span> dba_applications <span class="keyword">where</span> app_name <span class="operator">=</span> <span class="string">&#x27;APEX&#x27;</span>;</span><br><span class="line"><span class="keyword">select</span> app_name, app_statement, errornum, errormsg <span class="keyword">from</span> dba_app_errors <span class="keyword">where</span> app_name <span class="operator">=</span> <span class="string">&#x27;APEX&#x27;</span>;</span><br></pre></td></tr></table></figure>

<table>
<thead>
<tr>
<th>用户</th>
<th>环境</th>
<th>密码</th>
<th>备注</th>
</tr>
</thead>
<tbody><tr>
<td>APEX_PUBLIC_USER</td>
<td>testdb(165)</td>
<td>S9dFCaUaC</td>
<td>最低特权帐户用于通过ords和Oracle进行Application Express配置mod_plsql。</td>
</tr>
</tbody></table>
<ol start="2">
<li>非CDB/PDB模式安装apex</li>
</ol>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">&lt;!--非PDB模式 安装apex --&gt;</span><br><span class="line">@apexins.sql SYSAUX SYSAUX TEMP /i/</span><br><span class="line"></span><br><span class="line">&lt;!--验证apex安装结果--&gt;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">&lt;!--  设置 APEX_PUBLIC_USER --&gt;</span><br><span class="line">ALTER USER APEX_PUBLIC_USER IDENTIFIED BY S9dFCaUa ACCOUNT UNLOCK;</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<table>
<thead>
<tr>
<th>用户</th>
<th>环境</th>
<th>密码</th>
<th>备注</th>
</tr>
</thead>
<tbody><tr>
<td>APEX_PUBLIC_USER</td>
<td>test162</td>
<td>S9dFCaUaC</td>
<td>最低特权帐户。</td>
</tr>
</tbody></table>
<ol start="3">
<li>设置internal工作区admin用户,配置RESTful服务</li>
</ol>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"><span class="operator">&lt;</span><span class="operator">!</span><span class="comment">-- PDB模式切换SESSION--&gt;</span></span><br><span class="line"><span class="keyword">ALTER</span> SESSION <span class="keyword">SET</span> CONTAINER <span class="operator">=</span> testdb;</span><br><span class="line"></span><br><span class="line"><span class="operator">&lt;</span><span class="operator">!</span><span class="comment">--设置 INTERNAL 工作区的admin用户及密码--&gt;</span></span><br><span class="line"><span class="variable">@apxchpwd</span>.<span class="keyword">sql</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="operator">&lt;</span><span class="operator">!</span><span class="comment">-- PDB模式关闭SESSION--&gt;</span></span><br><span class="line"><span class="keyword">ALTER</span> SESSION <span class="keyword">SET</span> CONTAINER <span class="operator">=</span> testdb;</span><br><span class="line"><span class="operator">&lt;</span><span class="operator">!</span><span class="comment">--配置RESTful服务--&gt;</span></span><br><span class="line"><span class="variable">@apex</span>_rest_config.sql</span><br></pre></td></tr></table></figure>

<ol start="5">
<li>安装中文支持</li>
</ol>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">&lt;!--如果需要 PDB模式 切换库(PDB)--&gt; </span><br><span class="line">ALTER SESSION SET CONTAINER = xxxxxxx;</span><br><span class="line"><span class="comment">############################  注意 是APEX_190200用户   ############################ </span></span><br><span class="line">&lt;!--PDB模式 切换SCHEMA --&gt;</span><br><span class="line">ALTER SESSION SET CURRENT_SCHEMA = APEX_190200;</span><br><span class="line">&lt;!--安装中文支持--&gt;</span><br><span class="line">@/u01/apex/builder/zh-cn/load_zh-cn.sql</span><br></pre></td></tr></table></figure>

<ol start="4">
<li><p>APEX打补丁</p>
<ol>
<li><p><code>unzip p30392181_1920_Generic.zip</code></p>
</li>
<li><p>cat 30392181/README.txt</p>
</li>
<li><p>按照说明执行</p>
 <figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">...</span><br><span class="line">sqlplus <span class="string">&quot;sys/ as sysdba&quot;</span> </span><br><span class="line">&lt;!--切SESSION --&gt;</span><br><span class="line">&lt;!--以下任选其一--&gt;</span><br><span class="line">1. @catpatch.sql        -- 适用于Oracle数据库11.2及更早版本，适用于非CDB，以及APEX没有安装在根目录下的CDB</span><br><span class="line">2. @catpatch_con.sql    -- <span class="keyword">for</span> CDB <span class="built_in">where</span> Application Express is installed <span class="keyword">in</span> the root</span><br><span class="line">3. @catpatch_appcon.sql -- <span class="keyword">for</span> installations <span class="built_in">where</span> Application Express is installed <span class="keyword">in</span> an application container</span><br><span class="line">...</span><br></pre></td></tr></table></figure></li>
<li><p>验证补丁</p>
 <figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">select</span> APEX_INSTANCE_ADMIN.GET_PARAMETER( <span class="string">&#x27;APEX_19_2_0_PATCH_30392181&#x27;</span> ) <span class="keyword">from</span> dual;</span><br></pre></td></tr></table></figure></li>
</ol>
</li>
<li><p>备注留用</p>
</li>
</ol>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="operator">&lt;</span><span class="operator">!</span><span class="comment">--删除Apex--&gt;</span></span><br><span class="line"><span class="variable">@apxremov</span>.<span class="keyword">sql</span></span><br><span class="line"><span class="operator">&lt;</span><span class="operator">!</span><span class="comment">--执行后必须关闭SQL*Plus 重新打开--&gt;</span></span><br><span class="line"><span class="operator">&lt;</span><span class="operator">!</span><span class="comment">--关闭pdb--&gt;</span></span><br><span class="line"><span class="keyword">ALTER</span> PLUGGABLE DATABASE testdb <span class="keyword">CLOSE</span>;</span><br><span class="line"><span class="operator">&lt;</span><span class="operator">!</span><span class="comment">--删除pdb--&gt;</span></span><br><span class="line"><span class="keyword">DROP</span> PLUGGABLE DATABASE testdb INCLUDING DATAFILES;</span><br></pre></td></tr></table></figure>

<ol start="6">
<li><p>Apex ACl 配置</p>
 <figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">ALTER</span> SESSION <span class="keyword">SET</span> CONTAINER <span class="operator">=</span> testDB;</span><br><span class="line"></span><br><span class="line"><span class="keyword">declare</span></span><br><span class="line">l_acl_name  varchar2(<span class="number">30</span>) :<span class="operator">=</span> <span class="string">&#x27;HttpsServiceACLConfig.xml&#x27;</span>;</span><br><span class="line">l_principal varchar2(<span class="number">20</span>) :<span class="operator">=</span> <span class="string">&#x27;APEX_190200&#x27;</span>;</span><br><span class="line"><span class="keyword">begin</span></span><br><span class="line">    <span class="keyword">begin</span></span><br><span class="line">        dbms_network_acl_admin.drop_acl(acl <span class="operator">=</span><span class="operator">&gt;</span> l_acl_name);</span><br><span class="line">    exception</span><br><span class="line">        <span class="keyword">when</span> others <span class="keyword">then</span></span><br><span class="line">            <span class="keyword">null</span>; <span class="comment">-- ACL does not exist yet</span></span><br><span class="line">    <span class="keyword">end</span>;</span><br><span class="line">    dbms_network_acl_admin.create_acl(</span><br><span class="line">            acl <span class="operator">=</span><span class="operator">&gt;</span> l_acl_name</span><br><span class="line">        , description <span class="operator">=</span><span class="operator">&gt;</span> <span class="string">&#x27;ding ding https&#x27;</span></span><br><span class="line">        , principal <span class="operator">=</span><span class="operator">&gt;</span> l_principal</span><br><span class="line">        , is_grant <span class="operator">=</span><span class="operator">&gt;</span> <span class="literal">true</span></span><br><span class="line">        , privilege <span class="operator">=</span><span class="operator">&gt;</span> <span class="string">&#x27;connect&#x27;</span></span><br><span class="line">        , start_date <span class="operator">=</span><span class="operator">&gt;</span> systimestamp</span><br><span class="line">        , end_date <span class="operator">=</span><span class="operator">&gt;</span> <span class="keyword">null</span></span><br><span class="line">        );</span><br><span class="line">    dbms_network_acl_admin.add_privilege(</span><br><span class="line">            acl <span class="operator">=</span><span class="operator">&gt;</span> l_acl_name</span><br><span class="line">        , principal <span class="operator">=</span><span class="operator">&gt;</span> l_principal</span><br><span class="line">        , is_grant <span class="operator">=</span><span class="operator">&gt;</span> <span class="literal">true</span></span><br><span class="line">        , privilege <span class="operator">=</span><span class="operator">&gt;</span> <span class="string">&#x27;resolve&#x27;</span></span><br><span class="line">        , start_date <span class="operator">=</span><span class="operator">&gt;</span> systimestamp</span><br><span class="line">        , end_date <span class="operator">=</span><span class="operator">&gt;</span> <span class="keyword">null</span></span><br><span class="line">        );</span><br><span class="line">    <span class="comment">-- 添加钉钉</span></span><br><span class="line">    dbms_network_acl_admin.assign_acl(</span><br><span class="line">            acl <span class="operator">=</span><span class="operator">&gt;</span> l_acl_name</span><br><span class="line">        , host <span class="operator">=</span><span class="operator">&gt;</span> <span class="string">&#x27;*.dingtalk.com&#x27;</span></span><br><span class="line">        , lower_port <span class="operator">=</span><span class="operator">&gt;</span> <span class="number">443</span></span><br><span class="line">        , upper_port <span class="operator">=</span><span class="operator">&gt;</span> <span class="number">443</span></span><br><span class="line">        );</span><br><span class="line">    <span class="comment">-- 添加</span></span><br><span class="line">    dbms_network_acl_admin.assign_acl(</span><br><span class="line">            acl <span class="operator">=</span><span class="operator">&gt;</span> l_acl_name</span><br><span class="line">        , host <span class="operator">=</span><span class="operator">&gt;</span> <span class="string">&#x27;*.oracle.com&#x27;</span></span><br><span class="line">        , lower_port <span class="operator">=</span><span class="operator">&gt;</span> <span class="number">443</span></span><br><span class="line">        , upper_port <span class="operator">=</span><span class="operator">&gt;</span> <span class="number">443</span></span><br><span class="line">        );</span><br><span class="line">    <span class="comment">--  删除</span></span><br><span class="line">    <span class="comment">-- DBMS_NETWORK_ACL_ADMIN.UNASSIGN_ACL(host =&gt;&#x27;*.oracle.com&#x27;);</span></span><br><span class="line">    <span class="keyword">commit</span>;</span><br><span class="line"><span class="keyword">end</span>;</span><br></pre></td></tr></table></figure></li>
<li><p>Apex wallet 配置</p>
 <figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> <span class="variable">$ORACLE_HOME</span></span><br><span class="line"><span class="built_in">pwd</span></span><br><span class="line">&lt;!--创建wallet目录--&gt;</span><br><span class="line">mkdir wallets</span><br><span class="line">&lt;!--创建wallet--&gt;</span><br><span class="line">orapki wallet create -wallet /xx/xx/xx/xx/xxx/xxx/wallets/https_wallet  -<span class="built_in">pwd</span> xxxxxxxx -auto_login </span><br><span class="line">&lt;!--复制证书--&gt;  <span class="comment">#  可以参考 7. 服务器验证证书 第一个 ---BEGIN CERTIFICATE---END CERTIFICATE---</span></span><br><span class="line">&lt;!--授权--&gt;</span><br><span class="line">chown -R oracle:oinstall /u01/ssl</span><br><span class="line">&lt;!--添加证书--&gt;</span><br><span class="line">orapki wallet add -wallet /xx/xx/xx/xx/xxx/xxx/wallets/https_wallet -trusted_cert -cert <span class="string">&quot;/u01/ssl/sts.cer&quot;</span> -<span class="built_in">pwd</span> xxxxxxxx</span><br><span class="line">&lt;!--查看wallet--&gt;</span><br><span class="line">orapki wallet display -wallet /xx/xx/xx/xx/xxx/xxx/wallets/https_wallet</span><br><span class="line">&lt;!--清空wallet--&gt;</span><br><span class="line">orapki wallet remove -wallet /xx/xx/xx/xx/xxx/xxx/wallets/https_wallet  -trusted_cert_all  -<span class="built_in">pwd</span> xxxxx    </span><br></pre></td></tr></table></figure>
  <!--验证https--></li>
<li><p>验证https</p>
 <figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">select</span> </span><br><span class="line">apex_web_service.make_rest_request(p_url<span class="operator">=</span><span class="operator">&gt;</span><span class="string">&#x27;https://xxxxx.xxxx.com/adfs/oauth2/token&#x27;</span>,</span><br><span class="line">p_http_method <span class="operator">=</span><span class="operator">&gt;</span> <span class="string">&#x27;GET&#x27;</span>,</span><br><span class="line">p_wallet_path <span class="operator">=</span><span class="operator">&gt;</span> <span class="string">&#x27;file:/xx/xx/xx/xx/xxx/xxx/wallets/https_wallet&#x27;</span>) </span><br><span class="line"><span class="keyword">from</span> dual;</span><br></pre></td></tr></table></figure></li>
</ol>
<p>8.1. 正常请求post接口</p>
<pre><code><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">declare</span></span><br><span class="line">    l_clob1              <span class="type">clob</span>;</span><br><span class="line">    l_response_json_clob <span class="type">clob</span>;</span><br><span class="line">    L_1                  <span class="type">clob</span> :<span class="operator">=</span> <span class="string">&#x27;&#x27;</span>;</span><br><span class="line"><span class="keyword">begin</span></span><br><span class="line">    apex_json.initialize_clob_output;</span><br><span class="line">    apex_json.open_object;</span><br><span class="line">    apex_json.write(<span class="string">&#x27;AppId&#x27;</span>, <span class="string">&#x27;&#x27;</span>);</span><br><span class="line">    apex_json.write(<span class="string">&#x27;AppSecret&#x27;</span>, <span class="string">&#x27;B&#x27;</span>);</span><br><span class="line">    apex_json.open_array(<span class="string">&#x27;Email&#x27;</span>);</span><br><span class="line">    <span class="keyword">for</span> i <span class="keyword">in</span> <span class="number">1.</span><span class="number">.2</span></span><br><span class="line">        loop</span><br><span class="line">            apex_json.open_object;</span><br><span class="line">            apex_json.write(<span class="string">&#x27;from&#x27;</span>, <span class="string">&#x27;@.com&#x27;</span>);</span><br><span class="line">            apex_json.write(<span class="string">&#x27;to&#x27;</span>, <span class="string">&#x27;@.com&#x27;</span>);</span><br><span class="line">            apex_json.write(<span class="string">&#x27;subject&#x27;</span>, <span class="string">&#x27;下&#x27;</span>);</span><br><span class="line">            apex_json.write(<span class="string">&#x27;body&#x27;</span>, L_1);</span><br><span class="line">            apex_json.close_object;</span><br><span class="line">        <span class="keyword">end</span> loop;</span><br><span class="line">    apex_json.close_array;</span><br><span class="line">    apex_json.close_object;</span><br><span class="line">    l_clob1 :<span class="operator">=</span> apex_json.get_clob_output;</span><br><span class="line">    apex_json.free_output;</span><br><span class="line">    apex_web_service.g_request_headers(<span class="number">1</span>).name :<span class="operator">=</span> <span class="string">&#x27;Content-Type&#x27;</span>;</span><br><span class="line">    apex_web_service.g_request_headers(<span class="number">1</span>).<span class="keyword">VALUE</span> :<span class="operator">=</span> <span class="string">&#x27;application/json&#x27;</span>;</span><br><span class="line">    l_response_json_clob :<span class="operator">=</span> apex_web_service.make_rest_request(</span><br><span class="line">            p_url <span class="operator">=</span><span class="operator">&gt;</span> <span class="string">&#x27;http://xxxx/api/EmailSender/SendEmail&#x27;</span>,</span><br><span class="line">            p_http_method <span class="operator">=</span><span class="operator">&gt;</span> <span class="string">&#x27;POST&#x27;</span>,</span><br><span class="line">            p_body <span class="operator">=</span><span class="operator">&gt;</span> l_clob1);</span><br><span class="line"></span><br><span class="line">    apex_debug.warn(l_response_json_clob);</span><br><span class="line">    <span class="keyword">end</span>;</span><br></pre></td></tr></table></figure>
</code></pre>
<ol start="7">
<li><p>服务器验证证书</p>
 <figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br></pre></td><td class="code"><pre><span class="line">openssl s_client -connect www.dingtalk.com:443 -tls1 -showcerts</span><br><span class="line">...</span><br><span class="line">CONNECTED(00000003)</span><br><span class="line">depth=2 C = BE, O = GlobalSign nv-sa, OU = Root CA, CN = GlobalSign Root CA</span><br><span class="line">verify <span class="built_in">return</span>:1</span><br><span class="line">depth=1 C = BE, O = GlobalSign nv-sa, CN = GlobalSign Organization Validation CA - SHA256 - G2</span><br><span class="line">verify <span class="built_in">return</span>:1</span><br><span class="line">depth=0 C = CN, ST = ZheJiang, L = HangZhou, O = <span class="string">&quot;Alibaba (China) Technology Co., Ltd.&quot;</span>, CN = *.dingtalk.com</span><br><span class="line">verify <span class="built_in">return</span>:1</span><br><span class="line">---</span><br><span class="line">Certificate chain</span><br><span class="line"> 0 s:/C=CN/ST=ZheJiang/L=HangZhou/O=Alibaba (China) Technology Co., Ltd./CN=*.dingtalk.com</span><br><span class="line">   i:/C=BE/O=GlobalSign nv-sa/CN=GlobalSign Organization Validation CA - SHA256 - G2</span><br><span class="line">-----BEGIN CERTIFICATE-----</span><br><span class="line">MIIGYDCCBUigAwIBAgIMCZwLPIt+KS8mrSqZMA0GCSqGSIb3DQEBCwUAMGYxCzAJ</span><br><span class="line">......</span><br><span class="line">Dn6XwwJTuLDHvdZhE54cswjBpc0OizT63hRg6X+C5syJB8CKLSJxJGmPThWuNbpI</span><br><span class="line">MVUwRA==</span><br><span class="line">-----END CERTIFICATE-----</span><br><span class="line"> 1 s:/C=BE/O=GlobalSign nv-sa/CN=GlobalSign Organization Validation CA - SHA256 - G2</span><br><span class="line">   i:/C=BE/O=GlobalSign nv-sa/OU=Root CA/CN=GlobalSign Root CA</span><br><span class="line">-----BEGIN CERTIFICATE-----</span><br><span class="line">MIIEaTCCA1GgAwIBAgILBAAAAAABRE7wQkcwDQYJKoZIhvcNAQELBQAwVzELMAkG</span><br><span class="line">.....</span><br><span class="line">SOlCdjSXVWkkDoPWoC209fN5ikkodBpBocLTJIg1MGCUF7ThBCIxPTsvFwayuJ2G</span><br><span class="line">K1pp74P1S8SqtCr4fKGxhZSM9AyHDPSsQPhZSZg=</span><br><span class="line">-----END CERTIFICATE-----</span><br><span class="line">---</span><br><span class="line">Server certificate</span><br><span class="line">subject=/C=CN/ST=ZheJiang/L=HangZhou/O=Alibaba (China) Technology Co., Ltd./CN=*.dingtalk.com</span><br><span class="line">issuer=/C=BE/O=GlobalSign nv-sa/CN=GlobalSign Organization Validation CA - SHA256 - G2</span><br><span class="line">---</span><br><span class="line">No client certificate CA names sent</span><br><span class="line">Server Temp Key: ECDH, P-256, 256 bits</span><br><span class="line">---</span><br><span class="line">SSL handshake has <span class="built_in">read</span> 3453 bytes and written 315 bytes</span><br><span class="line">---</span><br><span class="line">New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES128-SHA</span><br><span class="line">Server public key is 2048 bit</span><br><span class="line">Secure Renegotiation IS supported</span><br><span class="line">Compression: NONE</span><br><span class="line">Expansion: NONE</span><br><span class="line">No ALPN negotiated</span><br><span class="line">SSL-Session:</span><br><span class="line">    Protocol  : TLSv1</span><br><span class="line">    Cipher    : ECDHE-RSA-AES128-SHA</span><br><span class="line">    Session-ID: 795C7128D1F65CD328662802B1DCD0DC2D753A185568EE1A9BC9ED8172078942</span><br><span class="line">    Session-ID-ctx: </span><br><span class="line">    Master-Key: B5BE8CAF4C8CE29D0945324B39FEDC3E40B293DD7A5B8395248169B8AAC3587134E6D3B9D0ADFA75E3ADFB251233185D</span><br><span class="line">    Key-Arg   : None</span><br><span class="line">    Krb5 Principal: None</span><br><span class="line">    PSK identity: None</span><br><span class="line">    PSK identity hint: None</span><br><span class="line">    TLS session ticket lifetime hint: 600 (seconds)</span><br><span class="line">    TLS session ticket:</span><br><span class="line">    0000 - 86 a7 5b 81 b5 e0 db 84-29 fd 41 bd cb 2c 65 <span class="built_in">fc</span>   ..[.....).A..,e.</span><br><span class="line"></span><br><span class="line">    Start Time: 1585991577</span><br><span class="line">    Timeout   : 7200 (sec)</span><br><span class="line">    Verify <span class="built_in">return</span> code: 0 (ok)</span><br></pre></td></tr></table></figure></li>
</ol>
<h2 id="3-Ords"><a href="#3-Ords" class="headerlink" title="3.Ords"></a>3.Ords</h2><p><a target="_blank" rel="noopener" href="https://www.oracle.com/database/technologies/appdev/rest-data-services-downloads.html">下载地址</a></p>
<p><a target="_blank" rel="noopener" href="https://docs.oracle.com/en/database/oracle/oracle-rest-data-services/20.4/aelig/using-multitenant-architecture-oracle-rest-data-services.html">官方文档</a></p>
<p>-1. 注意如果是多个环境需要验证下ords的版本 <code>java -jar edex.war version</code> </p>
<ol start="0">
<li>设置URL前缀</li>
</ol>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">&lt;!--xxxx.com/ords 将变成 xxxx.com/edex--&gt;</span><br><span class="line">cp ords.war edex.war</span><br></pre></td></tr></table></figure>

<p>0.1. 安装或升级 ords<code>java -jar edex.war  schema  --database test162</code></p>
<ol>
<li>添加数据库 test162 <a target="_blank" rel="noopener" href="https://docs.oracle.com/en/database/oracle/oracle-rest-data-services/20.4/aelig/installing-REST-data-services.html#">官方提示说明</a></li>
</ol>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br></pre></td><td class="code"><pre><span class="line">&lt;!--配置ords连接数据库 test162--&gt;</span><br><span class="line">java -jar edex.war  setup --database test162</span><br><span class="line"></span><br><span class="line">[root@xxxxx ords]<span class="comment"># java -jar edex.war  setup --database test162</span></span><br><span class="line">Specify the database connection <span class="built_in">type</span> to use.</span><br><span class="line">Enter number <span class="keyword">for</span> [1] Basic  [2] TNS  [3] Custom URL [1]:</span><br><span class="line">Enter the name of the database server [localhost]:10.x.x.x</span><br><span class="line">Enter the database listen port [1521]:xxxx</span><br><span class="line">Enter 1 to specify the database service name, or 2 to specify the database SID [1]:</span><br><span class="line">Enter the database service name:edextest164</span><br><span class="line">Enter 1 <span class="keyword">if</span> you want to verify/install Oracle REST Data Services schema or 2 to skip this step [1]:</span><br><span class="line">Enter the database password <span class="keyword">for</span> ORDS_PUBLIC_USER:</span><br><span class="line">Confirm password:</span><br><span class="line">Requires to login with administrator privileges to verify Oracle REST Data Services schema.</span><br><span class="line"></span><br><span class="line">Enter the administrator username:sys</span><br><span class="line">Enter the database password <span class="keyword">for</span> SYS AS SYSDBA:</span><br><span class="line">Confirm password:</span><br><span class="line">Connecting to database user: SYS AS SYSDBA url: jdbc:oracle:thin:@//10.x.x.x:xxxx/edextest164</span><br><span class="line"></span><br><span class="line">Retrieving information.</span><br><span class="line">Enter the default tablespace <span class="keyword">for</span> ORDS_METADATA [SYSAUX]:</span><br><span class="line">Enter the temporary tablespace <span class="keyword">for</span> ORDS_METADATA [TEMP]:</span><br><span class="line">Enter the default tablespace <span class="keyword">for</span> ORDS_PUBLIC_USER [SYSAUX]:</span><br><span class="line">Enter the temporary tablespace <span class="keyword">for</span> ORDS_PUBLIC_USER [TEMP]:</span><br><span class="line">Enter 1 <span class="keyword">if</span> you want to use PL/SQL Gateway or 2 to skip this step.</span><br><span class="line">If using Oracle Application Express or migrating from mod_plsql <span class="keyword">then</span> you must enter 1 [1]:</span><br><span class="line">Enter the PL/SQL Gateway database user name [APEX_PUBLIC_USER]:</span><br><span class="line">Enter the database password <span class="keyword">for</span> APEX_PUBLIC_USER:</span><br><span class="line">Confirm password:</span><br><span class="line">Enter 1 to specify passwords <span class="keyword">for</span> Application Express RESTful Services database users (APEX_LISTENER, APEX_REST_PUBLIC_USER) or 2 to skip this step [1]:</span><br><span class="line">Enter the database password <span class="keyword">for</span> APEX_LISTENER:</span><br><span class="line">Confirm password:</span><br><span class="line">Enter the database password <span class="keyword">for</span> APEX_REST_PUBLIC_USER:</span><br><span class="line">Confirm password:</span><br><span class="line">Enter a number to select a feature to <span class="built_in">enable</span>:</span><br><span class="line">   [1] SQL Developer Web  (Enables all features)</span><br><span class="line">   [2] REST Enabled SQL</span><br><span class="line">   [3] Database API</span><br><span class="line">   [4] REST Enabled SQL and Database API</span><br><span class="line">   [5] None</span><br><span class="line">Choose [1]:</span><br><span class="line">2021-04-15T07:36:18.280Z INFO        reloaded pools: [|test162||, |test162|al|, |test162|pu|, |test162|rt|, |test163||, |test163|al|, |test163|pu|, |test163|rt|, |test164||, |test164|al|, |test164|rt|, |test164|pu|]</span><br><span class="line">Installing Oracle REST Data Services version 20.4.3.r0501904</span><br><span class="line">... Log file written to /root/ords_install_core_2021-04-15_153618_00432.log</span><br><span class="line">... Verified database prerequisites</span><br><span class="line">... Created Oracle REST Data Services proxy user</span><br><span class="line">... Created Oracle REST Data Services schema</span><br><span class="line">... Granted privileges to Oracle REST Data Services</span><br><span class="line">... Created Oracle REST Data Services database objects</span><br><span class="line">... Log file written to /root/ords_install_datamodel_2021-04-15_153629_00290.log</span><br><span class="line">... Log file written to /root/ords_install_apex_2021-04-15_153630_00155.log</span><br><span class="line">Completed installation <span class="keyword">for</span> Oracle REST Data Services version 20.4.3.r0501904. Elapsed time: 00:00:12.659 </span><br></pre></td></tr></table></figure>
<!--配置指向 xxx.com/edex/test162 将指向 test162这个数据库 -->

<ol start="2">
<li>配置指向 如:<code>xxx.com/edex/test162</code> 将指向 test162这个数据库</li>
</ol>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">java -jar edex.war map-url --<span class="built_in">type</span> base-path   /test162 test162</span><br></pre></td></tr></table></figure>
<!--或者直接编辑文件-->
<!--tree-->
<ol start="3">
<li>添加Ords相关配置(实测影响挺大的.) <a target="_blank" rel="noopener" href="https://docs.oracle.com/en/database/oracle/oracle-rest-data-services/20.4/aelig/about-REST-configuration-files.html#">官方文档</a></li>
</ol>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line">ls /opt/ords/conf/ords/</span><br><span class="line">conf/         credentials   defaults.xml  standalone/ </span><br><span class="line"></span><br><span class="line">vim /opt/ords/conf/ords/defaults.xml</span><br><span class="line">...</span><br><span class="line">&lt;entry key=<span class="string">&quot;debug.printDebugToScreen&quot;</span>&gt;<span class="literal">false</span>&lt;/entry&gt;</span><br><span class="line">&lt;entry key=<span class="string">&quot;feature.sdw&quot;</span>&gt;<span class="literal">true</span>&lt;/entry&gt;</span><br><span class="line">&lt;entry key=<span class="string">&quot;apex.jdbc.AbandonedConnectionTimeout&quot;</span>&gt;1900&lt;/entry&gt;</span><br><span class="line">&lt;entry key=<span class="string">&quot;apex.jdbc.DriverType&quot;</span>&gt;thin&lt;/entry&gt;</span><br><span class="line">&lt;entry key=<span class="string">&quot;apex.jdbc.InactivityTimeout&quot;</span>&gt;2000&lt;/entry&gt;</span><br><span class="line">&lt;entry key=<span class="string">&quot;apex.jdbc.InitialLimit&quot;</span>&gt;16&lt;/entry&gt;</span><br><span class="line">&lt;entry key=<span class="string">&quot;apex.jdbc.MaxConnectionReuseCount&quot;</span>&gt;50000&lt;/entry&gt;</span><br><span class="line">&lt;entry key=<span class="string">&quot;jdbc.MaxLimit&quot;</span>&gt;300&lt;/entry&gt;</span><br><span class="line">&lt;entry key=<span class="string">&quot;jdbc.MinLimit&quot;</span>&gt;130&lt;/entry&gt;</span><br><span class="line">&lt;entry key=<span class="string">&quot;jdbc.cleanup.mode&quot;</span>&gt;recycle&lt;/entry&gt;</span><br><span class="line">&lt;entry key=<span class="string">&quot;plsql.gateway.add&quot;</span>&gt;<span class="literal">true</span>&lt;/entry&gt;</span><br><span class="line">&lt;entry key=<span class="string">&quot;restEnabledSql.active&quot;</span>&gt;<span class="literal">true</span>&lt;/entry&gt;</span><br><span class="line"></span><br><span class="line">&lt;entry key=<span class="string">&quot;instance.api.enabled&quot;</span>&gt;<span class="literal">true</span>&lt;/entry&gt;</span><br><span class="line">...</span><br></pre></td></tr></table></figure>

<h2 id="3-Nginx"><a href="#3-Nginx" class="headerlink" title="3.Nginx"></a>3.Nginx</h2><ol>
<li><p>安装基础环境</p>
<ol>
<li>GCC编辑器<code> yum install -y gcc</code></li>
<li>gcc-c++ 自定义Nginx Http模块<code>yum install -y gcc-c++</code></li>
<li>PCRE 函数库支持正则表达式 <code>yum install -y pcre pcre-devel</code></li>
<li>zlib HTTP包gzip压缩<code>yum install -y zlib zlib-devel</code></li>
<li>OpenSSL 开发库Https支持 <code>yum install -y openssl openssl-devel</code></li>
</ol>
</li>
<li><p><a target="_blank" rel="noopener" href="http://nginx.org/download/nginx-1.19.10.tar.gz">下载 wget http://nginx.org/download/nginx-1.19.10.tar.gz)</a></p>
</li>
<li><p>解压<code>tar -zxvf nginx-1.19.10.tar.gz</code></p>
<ol>
<li>参数说明<a target="_blank" rel="noopener" href="http://nginx.org/en/docs/configure.html">见官网文档</a></li>
<li>–with-debug</li>
<li>–with-http_ssl_module</li>
<li>–with-http_v2_module</li>
<li>–with-http_realip_module</li>
<li>–with-http_gzip_static_module</li>
<li>–with-http_stub_status_module</li>
<li>–with-http_sub_module</li>
</ol>
 <figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> nginx-1.19.10</span><br><span class="line">&lt;!--编译三部曲--&gt;</span><br><span class="line">./configure --with-debug --with-http_ssl_module  --with-http_v2_module --with-http_realip_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_sub_module</span><br><span class="line"></span><br><span class="line">&lt;!--查看编译后的插件--&gt;</span><br><span class="line">cat auto/options | grep YES --color</span><br><span class="line"></span><br><span class="line">make</span><br><span class="line"></span><br></pre></td></tr></table></figure></li>
</ol>
<p>4.1. 升级</p>
<ol>
<li><p>备份旧版本和配置文件(可选)</p>
<p> mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx_old<br> mv /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.old</p>
</li>
<li><p>拷贝新版本<br>  cp ./objs/nginx /usr/local/nginx/sbin/nginx</p>
</li>
<li><p>验证配置文件<br> /usr/local/nginx/sbin/nginx -t</p>
</li>
<li><p>通知正在运行的Nginx<br> kill -s SIGUSR2 <nginx master pid> (nginx会将/usr/local/nginx/logs/pid文件重命名)</p>
</li>
<li><p>退出旧版本<br> kill -s SIGQUIT &lt;旧版本Nginx master pid&gt;</p>
</li>
<li><p>清理旧版本</p>
</li>
</ol>
<p>4.2. 新安装 <code>make install</code></p>
<ol start="5">
<li>nginx配置</li>
</ol>
 <figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br></pre></td><td class="code"><pre><span class="line">user nginx;</span><br><span class="line">worker_processes auto;</span><br><span class="line">error_log logs/error.log error;</span><br><span class="line">#error_log  logs/error.log  notice;</span><br><span class="line">#error_log  logs/error.log  info;</span><br><span class="line">pid logs/nginx.pid;</span><br><span class="line">events &#123;</span><br><span class="line">  worker_connections 5000;</span><br><span class="line">&#125;</span><br><span class="line">http &#123;</span><br><span class="line">  server_tokens off;# 隐藏版本号</span><br><span class="line">  charset UTF-8;</span><br><span class="line">  include mime.types;</span><br><span class="line">  default_type application/octet-stream;</span><br><span class="line"></span><br><span class="line">  log_format main &#x27;$remote_addr - $remote_user [$time_local] &quot;$request&quot; &#x27;</span><br><span class="line">  &#x27;$status $body_bytes_sent &quot;$http_referer&quot; &#x27;</span><br><span class="line">  &#x27;&quot;$http_user_agent&quot; &quot;$http_x_forwarded_for&quot;&#x27;;</span><br><span class="line">  log_format timing &#x27;$remote_addr - $remote_user [$time_local] $request&#x27;</span><br><span class="line">  &#x27;upstream_response_time $upstream_response_time&#x27;</span><br><span class="line">  &#x27;msec $msec request_time $request_time&#x27;;</span><br><span class="line">  log_format up_head &#x27;$remote_addr - $remote_user [$time_local] $request&#x27;</span><br><span class="line">  &#x27;upstream_http_content_type $upstream_http_content_type&#x27;;</span><br><span class="line">  access_log logs/access.log main;</span><br><span class="line"></span><br><span class="line">  sendfile on;</span><br><span class="line">  #tcp_nopush     on;</span><br><span class="line">  client_max_body_size 64M;</span><br><span class="line">  #keepalive_timeout  0;</span><br><span class="line">  keepalive_timeout 65;</span><br><span class="line"></span><br><span class="line">  gzip on;</span><br><span class="line">  gzip_min_length 1k;</span><br><span class="line">  gzip_buffers 4 16k;</span><br><span class="line">  #gzip_http_version 1.0;</span><br><span class="line">  gzip_comp_level 2;</span><br><span class="line">  gzip_types application/javascript text/plain application/-javascript image/jpeg image/gif image/png application/css text/css application/xml text/javascript</span><br><span class="line">  gzip_vary off;</span><br><span class="line">  gzip_disable &quot;MSIE [1-6]\.&quot;;</span><br><span class="line">  </span><br><span class="line">  gzip_static  on;</span><br><span class="line">  gzip_proxied expired no-cache no-store private auth;</span><br><span class="line">  </span><br><span class="line">  upstream backend &#123;</span><br><span class="line">    ip_hash;  # 文档 http://nginx.org/en/docs/http/ngx_http_upstream_module.html#ip_hash</span><br><span class="line">    server 10.x.x.x:8080;</span><br><span class="line">    server 10.x.x.x:8080 down;</span><br><span class="line">    server 10.x.x.x:8080;</span><br><span class="line">  &#125;</span><br><span class="line">  server &#123;</span><br><span class="line">    listen 80;</span><br><span class="line">#     兼容旧的连接</span><br><span class="line">    location ^~ /ords/ &#123;</span><br><span class="line">        rewrite ^/ords(.*)$ /edex/test162$1    redirect;</span><br><span class="line">    &#125;</span><br><span class="line">    location ^~ /edex/ &#123;</span><br><span class="line">      proxy_pass http://backend/edex/;</span><br><span class="line">      proxy_set_header Host $host;</span><br><span class="line">      proxy_set_header Origin &quot;&quot;;</span><br><span class="line">      proxy_set_header X-Forwarded-Proto $scheme;</span><br><span class="line">      proxy_set_header X-Real-IP $remote_addr;</span><br><span class="line">      proxy_set_header X-Real-Port $remote_port;</span><br><span class="line">      #proxy_set_header Host $host;</span><br><span class="line">      proxy_set_header X-Forwarded-Server $host;</span><br><span class="line">      #proxy_redirect http://$host/ords/ https://$host/ords/;</span><br><span class="line">      #proxy_redirect off;</span><br><span class="line">      proxy_set_header X-Forwarded-Host $server_port;</span><br><span class="line">      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;</span><br><span class="line">    &#125;</span><br><span class="line">    location /i/ &#123;</span><br><span class="line">      root html;</span><br><span class="line">    &#125;</span><br><span class="line">    error_page 500 502 503 504 /50x.html;</span><br><span class="line">    error_page 404 /404.html;</span><br><span class="line">    location = /50x.html &#123;</span><br><span class="line">      root html;</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<ol start="6">
<li><p>拷贝apex静态文件 <code>cp -fr /opt/tomcat/webapps/i /usr/local/nginx/html</code></p>
</li>
<li><p>SSL配置</p>
 <figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">server &#123;</span><br><span class="line">  listen 443 ssl http2;</span><br><span class="line">  ssl_certificate /etc/nginx/certificate/crt_2021/wcom.crt;</span><br><span class="line">  ssl_certificate_key /etc/nginx/certificate/crt_2021/wcom.key;</span><br><span class="line">  ssl_session_cache	shared:SSL:1m;</span><br><span class="line">  ssl_prefer_server_ciphers on;</span><br></pre></td></tr></table></figure></li>
</ol>
<h3 id="后期处理"><a href="#后期处理" class="headerlink" title="后期处理"></a>后期处理</h3><h2 id="常见问题"><a href="#常见问题" class="headerlink" title="常见问题"></a>常见问题</h2><ol>
<li><p>使用Oauth2 认证时出现奇奇怪怪的重定向<br> 如:<code>redirect_uri=https://xx.xx.com:80/ords </code><br> <a target="_blank" rel="noopener" href="https://www.oracle-and-apex.com/tomcat-with-ords-running-apex-behind-a-reverse-proxy/">解决办法</a> tomcat server.xml 配置 添加<code>scheme=&quot;https&quot;</code></p>
 <figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">&lt;Connector port=&quot;8080&quot; protocol=&quot;HTTP/1.1&quot;</span><br><span class="line">       connectionTimeout=&quot;20000&quot;</span><br><span class="line">       proxyPort=&quot;443&quot;</span><br><span class="line">       scheme=&quot;https&quot;</span><br><span class="line">       redirectPort=&quot;8443&quot; /&gt;</span><br></pre></td></tr></table></figure></li>
</ol>

        </article>
        <section class="post-near">
            <ul>
                
                    <li>上一篇: <a href="/2021/11/05/e7f888284497/">Oracle AES加解密Demo</a></li>
                
                
                    <li>下一篇: <a href="/2020/06/19/51bba7999d3f/">【夜读】你不必迎合所有人</a></li>
                
            </ul>
        </section>
        
            <section class="post-tags">
            <a class="-none-link" href="/tags/Apex/" rel="tag">Apex</a><a class="-none-link" href="/tags/Nginx/" rel="tag">Nginx</a><a class="-none-link" href="/tags/Ords/" rel="tag">Ords</a><a class="-none-link" href="/tags/SQLcl/" rel="tag">SQLcl</a><a class="-none-link" href="/tags/Tomcat/" rel="tag">Tomcat</a><a class="-none-link" href="/tags/%E5%85%83%E5%AE%87%E5%AE%99/" rel="tag">元宇宙</a>
            </section>
        
    
        <section class="post-author">
        
            <figure class="author-avatar">
                <!-- <img src="https://metaverse-1256174970.cos.ap-shanghai.myqcloud.com/image_%2Fahmed-mulla-hS-2bYjeyWc-unsplash.jpg" alt="Pan" /> -->
                <img src="https://nuczmjfhvndrjhrfpqkcyeimmdrcsebw.oss-cn-shanghai.aliyuncs.com/jbfffurvdqmpvhukbzbsea/QPWp3GjspHEz8QHi6RDm.jpeg" alt="Pan" >
            </figure>
        
            <div class="author-info">
                <h4>Pan</h4>
                <p>社会主义螺丝钉,币圈韭菜,A股韭菜</p>
            </div>
        </section>
    
    </div>
</main>

    <footer>
    <div class="buttons">
        <a class="to-top" href="#"></a>
    </div>
    <div class="wrap min">
        <section class="widget">
            <div class="row">
                <div class="col-m-4">
                    <h3 class="title-recent">最新文章：</h3>
                    <ul class="post-list"><li class="post-list-item"><a class="post-list-link" href="/2022/05/01/0586406b1d50/">不同衣物收纳教程</a></li><li class="post-list-item"><a class="post-list-link" href="/2022/01/13/6578eb87a21b/">Apex直传阿里云OSS</a></li><li class="post-list-item"><a class="post-list-link" href="/2021/12/13/3449662a057f/">Oracle Apex IR 多选批量处理后页面局部刷新</a></li><li class="post-list-item"><a class="post-list-link" href="/2021/11/05/60190b5049e6/">Apex上传文件至Windows网盘</a></li><li class="post-list-item"><a class="post-list-link" href="/2021/11/05/b209999e9b35/">Apex对接钉钉免登</a></li><li class="post-list-item"><a class="post-list-link" href="/2021/11/05/e7f888284497/">Oracle AES加解密Demo</a></li></ul>
                </div>
                <div class="col-m-4">
                    <h3 class="title-date">时光机：</h3>
                    <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2022/05/">五月 2022</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2022/01/">一月 2022</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/12/">十二月 2021</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/11/">十一月 2021</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/06/">六月 2020</a></li></ul>
                </div>
                <div class="col-m-4">
                    <h3 class="title-tags">标签云：</h3>
                    <a href="/tags/AES/" style="font-size: 10px;">AES</a> <a href="/tags/Apex/" style="font-size: 16.67px;">Apex</a> <a href="/tags/CSS/" style="font-size: 10px;">CSS</a> <a href="/tags/HTML/" style="font-size: 10px;">HTML</a> <a href="/tags/JS/" style="font-size: 10px;">JS</a> <a href="/tags/Nginx/" style="font-size: 10px;">Nginx</a> <a href="/tags/OSS/" style="font-size: 10px;">OSS</a> <a href="/tags/Oracle/" style="font-size: 13.33px;">Oracle</a> <a href="/tags/Ords/" style="font-size: 10px;">Ords</a> <a href="/tags/PL-SQL/" style="font-size: 10px;">PL/SQL</a> <a href="/tags/SQLcl/" style="font-size: 10px;">SQLcl</a> <a href="/tags/Tomcat/" style="font-size: 10px;">Tomcat</a> <a href="/tags/Windows/" style="font-size: 10px;">Windows</a> <a href="/tags/%E5%85%83%E5%AE%87%E5%AE%99/" style="font-size: 20px;">元宇宙</a> <a href="/tags/%E5%A4%9C%E8%AF%BB/" style="font-size: 13.33px;">夜读</a> <a href="/tags/%E6%9D%82%E9%A1%B9/" style="font-size: 10px;">杂项</a> <a href="/tags/%E7%BD%91%E7%9B%98/" style="font-size: 10px;">网盘</a> <a href="/tags/%E8%BD%AC%E8%BD%BD/" style="font-size: 13.33px;">转载</a> <a href="/tags/%E9%92%89%E9%92%89/" style="font-size: 10px;">钉钉</a> <a href="/tags/%E9%98%BF%E9%87%8C%E4%BA%91/" style="font-size: 10px;">阿里云</a>
                </div>
            </div>
        </section>
        <section class="sub-footer">
            <p>友链:<a href="https://wangfanggang.com/" target="_blank">钢钢更新</a></p>
            <p><span>用于分享个人成长经历,日常状况.心情感悟,分享Apex开发经验,Python开发经验,Go等一系列学习笔记.作为网络知识储备.也会记录一些网络金句</span></p>
            <p>© 2022 
                <a href="/">我的元宇宙</a>. All Rights Reserved. Theme By 
                <a href="https://github.com/Dreamer-Paul/Hingle" target="_blank" rel="nofollow">Hingle</a>.
                <a target="_blank" rel="noopener" href="https://beian.miit.gov.cn/">豫ICP备19030991号</a></p>
        </section>
    </div>
    
</footer>


<script src="/static/kico.js"></script>
<script src="/static/hingle.js"></script>


<script>var hingle = new Paul_Hingle({"copyright":true,"night":true});</script>

  </body>
</html>
